//
//  ShareInstance.m
//  XIBProje
//
//  Created by meitianhui2 on 2017/11/29.
//  Copyright © 2017年 DeLongYang. All rights reserved.
//

#import "ShareInstance.h"

@implementation ShareInstance

+ (ShareInstance *)shareInstance
{
    static dispatch_once_t once;
    static ShareInstance *shareInstance;
    dispatch_once(&once, ^{
        shareInstance = [[self alloc] init];
    });
    return shareInstance;
}

- (instancetype) init
{
    self = [super init];
    if (self) {
        NSLog(@"这是单例的 初始化方法  应该 只能执行一次 ，如果多次出现，就是出现问题了");
        _index = 500;
    }
    return self;
}

- (IBAction)customSetIndex:(id)sender
{
    NSInteger randomValue = arc4random()%5;
    _index = randomValue;
    NSLog(@"randomValue is %ld",(long)_index);
}


@end
